<?php
// function that iterates over an array , and calls a function on every 
// element in that array , it returns a new array with every item
// replaced by the result of the callback
    function my_array_map($array, $callback) {
        // initial result variable
        $result = array();

        var_dump($callback);
        // loop through the array 
        foreach ($array as $index => &$item) {
            // call the callback on the item
            $callback($item);
            $result[$index] = $item;// lambda的返回值为NULL，所以只能用引用的方式解决
        }

        var_dump($result);
        // done
        return $result;
    }

    run_test();